<?php

/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/

Route::get('/', 'IndexController@index');
Route::get('/{menu}', function ($menu) {
    return view('index.cate');
})->where(['menu' => '.*xiaoshuo$']);


Route::group(['prefix'=>'admin','middleware' => ['auth']], function () {
   
        Route::get('', function () {
            return view('admin_template');
        });
        Route::prefix('link')->group(function () {
            Route::get('', 'LinkController@index')->name('admin.link');
            Route::get('edit/{id}', 'LinkController@update')->name('admin.link.edit');
            Route::get('destroy/{id}', 'LinkController@destroy')->name('admin.link.destroy');
            Route::post('store', 'LinkController@store')->name('admin.link.add');
        });

        Route::prefix('site')->group(function () {
            Route::get('', 'SiteController@index')->name('admin.site');
            Route::post('update', 'SiteController@update')->name('admin.site.update');
        });
        Route::prefix('cate')->group(function () {
            Route::get('', 'CategoryController@index')->name('admin.cate');
            Route::get('edit/{id}', 'CategoryController@update')->name('admin.cate.edit');
            Route::get('destroy/{id}', 'CategoryController@destroy')->name('admin.cate.destroy');
            Route::post('store', 'CategoryController@store')->name('admin.cate.add');
        });
        Route::prefix('novel')->group(function () {
            Route::get('', 'NovelController@index')->name('admin.novel');
            Route::post('update/{id}', 'NovelController@update')->name('admin.novel.update');
            Route::get('destroy/{id}', 'NovelController@destroy')->name('admin.novel.delete');
            Route::post('store', 'NovelController@store')->name('admin.novel.add');
            Route::get('vol/{id}', 'VolController@index')->name('admin.novel.vols');
            Route::get('create', 'NovelController@create')->name('admin.novel.create');
            Route::get('edit/{id}', 'NovelController@edit')->name('admin.novel.edit');
            Route::get('dig/{id}', 'NovelController@digNovel')->name('admin.novel.dig');
        });
        Route::prefix('vol')->group(function () {
            Route::get('edit/{id}', 'VolController@update')->name('admin.vol.edit');
            Route::get('destroy/{id}', 'VolController@destroy')->name('admin.vol.destroy');
            Route::get('create/{id}', 'VolController@create')->name('admin.vol.create');
            Route::post('store/{id}', 'VolController@store')->name('admin.vol.add');
        });
        Route::prefix('content')->group(function () {
            Route::get('/{id}', 'ContentController@index')->name('admin.content');
            Route::get('edit/{id}', 'ContentController@edit')->name('admin.content.edit');
            Route::get('destroy/{id}', 'ContentController@destroy')->name('admin.content.destroy');
            Route::post('store/{id}', 'ContentController@store')->name('admin.content.store');
            Route::post('update/{id}', 'ContentController@update')->name('admin.content.update');
            Route::get('create/{id}', 'ContentController@create')->name('admin.content.create');
        });
        Route::prefix('type')->group(function () {
            Route::get('', 'TypeController@index')->name('admin.type');
            Route::get('edit/{id}', 'TypeController@edit')->name('admin.type.edit');
            Route::get('destroy/{id}', 'TypeController@destroy')->name('admin.type.destroy');
            Route::post('store/{id}', 'TypeController@store')->name('admin.type.store');
            Route::post('update/{id}', 'TypeController@update')->name('admin.type.update');
            Route::get('create', 'TypeController@create')->name('admin.type.create');
        });
    
});
Route::get('vol/{id}', 'VolController@show')->name('vol');
Auth::routes();

Route::get('/home', 'HomeController@index')->name('home');
